#ifndef __DATABASE_H__
#define __DATABASE_H__

#ifdef WIN32
#include "winsock2.h"
#include "mysql.h"
#elif defined(LINUX)
#include "mysql.h"
#endif


/*  check g_config.db_init flag after this */
#define  init_db() do {		\
	if ( g_config.db_init )	{		\
		g_config.db_init = mysql_library_init(0, 0, 0);		\
	} \
	if ( g_config.db_init )			\
		SYS_ERR("mysql_library_init");		\
} while(0)

#define destroy_db() do { \
	mysql_library_end(); } while(0)

/* mysql */
#if defined(LINUX)
#define MYSQL_HOST "localhost"
#elif defined(WIN32)
#define MYSQL_HOST "203.195.132.232"
#else
#error "platform not specified!"
#endif

#define MYSQL_USER "test"
#define MYSQL_PSWD "test"
#define MYSQL_BASE "test"

#endif //__DATABASE_H__